<?php
/**
	 * This class is part of the Action Script 3 library from Michael Fretz for www.michaelfretz.com
	 *
	 * Description: upload.php is a PHP fiel to upload a file to a webserver. 
	 * In case some errors happens you might need a htaccess File on your hosting account with following content:
	 * SecFilterEngine Off
	 * SecFilterScanPOST Off
	 *
	 *
	 * todo: check file tpye to make the file more secure
	 * 
	 * @author: Michael Fretz
	 * @last change: 21.12.2008
	 * @filename:  upload.php
	 * @licence GNU Lesser General Public License -> http://www.gnu.org/licenses/lgpl.html
	 * 
	 */
	 
$id = $_POST['id'];

$hostname_conn = "localhost";
$database_conn = "multilinearestories";
$username_conn = "gamerbeatmulti";
$password_conn = "iadbeat2000";
$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database_conn, $conn);


if (is_uploaded_file($_FILES['Filedata']['tmp_name'])){
		

			$uploadDirectory="assets/images/";
			$uploadFile=$uploadDirectory.basename($_FILES['Filedata']['name']);
			$today = date("Ymdhs");
			$bildname = $today.basename($_FILES['Filedata']['name']);
			$neuername =  $uploadDirectory.$bildname;
			
			move_uploaded_file($_FILES['Filedata']['tmp_name'], $neuername);
	
	
			$q = "UPDATE nodes SET bild='$bildname' WHERE id='$id'";
			mysql_query($q, $conn);
		
		
}
	
			


?> 